package com.maotai.app.timetask;



import javax.annotation.Resource;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.maotai.app.service.MaotaiAppService;
import com.maotai.app.thread.MaoTaiAppShopThread;
import com.maotai.llzhou.util.IPFactory;

/**
 * 注册
 */
public class MaotaiAppShopTask {

	@Resource(name = "maotaiAppService")
	private MaotaiAppService maotaiAppService;

	public void beginTask() {
		try {
			JSONArray jArray = IPFactory.getIpAndPort();
			int countData = jArray.size();
			for (int i = 0; i < countData; i++) {
				JSONObject jj = (JSONObject) jArray.get(i);
				String ipAndPort = jj.getString("ip")+":"+jj.getString("port");
				
				MaoTaiAppShopThread tt = new MaoTaiAppShopThread(maotaiAppService,ipAndPort);
				tt.start();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
